const lbbService = require('../service/service.js')
//schedule.js
const app = getApp()

Page({
  data: {
    detail: {},
  },
  onLoad: function (options) {
    let that = this
    console.log(options)
    // Do some initialize when page load.
    let id  = options.id
    console.log("输出了id",id)
    let reportId = options.reportId
    console.log("输出了reportId", reportId)
    that.setData({
      id: id,
      reportId : reportId,
      scrollHeight: app.getScrollHeight(0)
    })
    let title = "下线控制盒";
    if(id == 1){
      title = "下线控制盒";
    }else if(id == 2){
      title = '上线控制盒';
    } else if (id == 3) {
      title = '上线设备';
    } else if (id == 4) {
      title = '下线设备';
    } else if (id == 5) {
      title = '确认丢失';
    } else if (id == 6) {
      title = '变更控制盒位置';
    } else if (id == 7) {
      title = '设备变更位置';
    } else if (id == 8) {
      title = '处理控制盒维修';
    } else if (id == 9) {
      title = '处理设备维修';
    } else if (id == 10) {
      title = '处理客服反馈';
    } else if (id == 11) {
      title = '更换电池';
    } else if (id == 12) {
      title = '未开锁控制盒';
    } else if (id == 13) {
      title = '未巡检轮椅';
    }
    wx.setNavigationBarTitle({
      title: title,
    })
    // console.log(that.data)
    if(id == 1 || id == 2 || id == 3 || id == 4 || id == 5){
      lbbService.getUserReportInfo({ reportId: reportId, typeId: id }, function (res) {
        console.log("输出了res", res)
        that.setData({
          personalReportList: res
        })
        // if (that.data.hospitalId) {
        //   that.filterList()
        // }
      })
    }else if(id== 6 || id== 7){
      lbbService.getUserReportChangeInfo({ reportId: reportId, typeId: id }, function (res) {
        console.log("输出了res", res)
        that.setData({
          personalReportList: res
        })
        // if (that.data.hospitalId) {
        //   that.filterList()
        // }
      })
    }else if(id == 8 || id == 9){
      lbbService.getUserReportHandleRepairInfo({ reportId: reportId, typeId: id }, function (res) {
        console.log("输出了res", res)
        that.setData({
          personalReportList: res
        })
        // if (that.data.hospitalId) {
        //   that.filterList()
        // }
      })
    }else if(id == 10 ){
      lbbService.getQuestionFeedbackInfo({ reportId: reportId, typeId: id }, function (res) {
        console.log("输出了res", res)
        that.setData({
          personalReportList: res
        })
        // if (that.data.hospitalId) {
        //   that.filterList()
        // }
      })
    }else if(id == 11){
      lbbService.getChargeBatterInfo({ reportId: reportId, typeId: id }, function (res) {
        console.log("输出了res", res)
        that.setData({
          personalReportList: res
        })
        // if (that.data.hospitalId) {
        //   that.filterList()
        // }
      })
    }else if(id == 12){
      lbbService.getUncheckedPileInfo({ reportId: reportId, typeId: id }, function (res) {
        console.log("输出了res", res)
        that.setData({
          personalReportList: res.data
        })
      })
    }else if(id == 13){
      lbbService.getUncheckedEquInfo({ reportId: reportId, typeId: id }, function (res) {
        console.log("输出了res", res)
        that.setData({
          personalReportList: res.data
        })
      })
    }
  },


  
  onReady: function () {
    // Do something when page ready.
  },
  onShow: function () {
    // Do something when page show.
  },
  onHide: function () {
    // Do something when page hide.
  },
  onUnload: function () {
    // Do something when page close.
  },
  onPullDownRefresh: function () {
    // Do something when pull down
  },
  // Event handler.
 
})